#include<iostream>
#include<string>
#include<cmath>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
LL f[N];
int n, k;
int main()
{
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> f[i];
		f[i] += f[i - 1];
	}
	LL ma = 0;
	for (int i = k; i <= n; i++) {
		ma = max(ma, f[i] - f[i - k]);
	}
	cout << ma << endl;
	return 0;
}